<template>
  <div class="nav-bar">
    <div class="nav-bar-inner">
      <span 
        class="nav-bar-item hover-style" 
        :class="currentTabIndex == index ? 'active' : '' "
        v-for="(item, index) in lotterys" 
        :key="item.id"
        @click="chooseType(index)"
      >
        {{item.tab}}
      </span>
      <span class="nav-bar-item record hover-style">
        <span></span>
        <span>开奖记录</span>
      </span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    lotterys: {
      type: Array,
      require: true
    },
    currentTabIndex: {
      type: Number,
      default: 0
    }
  },
  methods: {
    chooseType(index) {
      this.$emit('click', index)
    }
  }
}
</script>

<style lang="stylus" scoped>
  @import '~@/assets/styles/variables.styl'
  .nav-bar
    width 100%
    height 48px 
    background-color #fff
    .nav-bar-inner
      width 1200px
      margin 0 auto
      height 48px
      line-height 48px
      .nav-bar-item
        font-size 15px
        font-family Arial 
        font-weight 700
        color $color-theme-dark
        margin-right 20px
        &.active 
          color $color-theme-red 
        &.record
          float right
</style>